﻿using System;
using System.Collections.Generic;
using System.Text;
using VoteServices.VoteClass;
using VoteServices.VoteModel;

namespace Vote
{
    /// <summary>
    /// 模型转化
    /// </summary>
    class Models
    {
        public ProblemModel problemModel(Problem problem)
        {
            ProblemModel newProblem = new ProblemModel()
            {
                Id = problem.Id,
                Detail = problem.Detail
            };
            
            return newProblem;
        }
        public OptionModel optionModel(Option option)
        {
            OptionModel newOption = new OptionModel()
            {
                Detail = option.Detail,
                Votes = option.Votes
            };
           
            return newOption;
        }
        public RecordModel recordModel(Record record)
        {
            RecordModel newRecord = new RecordModel()
            {
                VoteTime = record.VoteTime,
                VoteUser = record.VoteUser
            };
            
            return newRecord;
        }
        public UserModel userModel(User user)
        {
            UserModel newUser = new UserModel();
            newUser.Account = user.Account;
            newUser.Name = user.Name;
            return newUser;
        }

    }
}
